﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HashTable
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable h1 = new Hashtable();
            h1.Add(01, "《把时间当朋友》");
            h1.Add(02, "《想点大事》");
            h1.Add(03, "《相对论》");
            h1.Add(04, "《说笑》");

            Console.WriteLine("请输入书籍编号：");
            int id = int.Parse(Console.ReadLine());
            bool flag = h1.ContainsKey(id);
            if(flag)
            {
                Console.WriteLine("你想阅览的书籍：{0}", h1[id].ToString()) ;
            }
            else
            {
                Console.WriteLine("没有找到该书");
                Console.WriteLine("书单书籍有：");
                foreach(DictionaryEntry v in h1)
                {
                    int key = (int)v.Key; string value = v.Value.ToString();
                    Console.WriteLine("书籍编号：{0}，菜名：{1}", key, value);
                }
            }

        }
    }
}
